package com.apress.springrecipes.sequence;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.apress.springrecipes.hello.Holiday;
public class Main {
	public static void main(String[] args)
	{
		ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
		Holiday christmas = (Holiday)context.getBean("christmas");
		System.out.println("christmas date: " + christmas.getMonth() + " " + christmas.getDay());
		Holiday christmas2 = (Holiday)context.getBean("christmas");
		christmas2.setDay(99);
		christmas2.setMonth(666);
		System.out.println("\n\nchristmas2 date: " + christmas2.getMonth() + " " + christmas2.getDay());
		System.out.println("christmas date: " + christmas.getMonth() + " " + christmas.getDay());
		/*
		SequenceService sequenceService =
		(SequenceService) context.getBean("sequenceService");
		SequenceService sequenceService2 =
			(SequenceService) context.getBean("sequenceService");
		System.out.println("first seq:" + sequenceService.generate("IT"));
		System.out.println("\n\nsecond seq:" + sequenceService2.generate("MIS"));
		
		if(sequenceService.equals(sequenceService2)) {
			System.out.println("\n\nseq1 and seq2 are the same!!");
		}
		
		SequenceGenerator generator = (SequenceGenerator)context.getBean("sequenceGenerator");
		System.out.println(generator.getSequence());
		System.out.println(generator.getSequence());
		*/
	}
}
 